import request from '@/utils/request'
const api_name = '/manage/admin/categories'

export function getPageList(page,limit,data) {
  return request({
    url: `${api_name}/${page}/${limit}`,
    method: 'get',
    params: data
  })
}

export function getCategoryById(id) {
  return request({
    url: `${api_name}/${id}`,
    method: 'get'
  })
}


export function saveCategory(data) {
  return request({
    url: `${api_name}/`,
    method: 'post',
    data
  })
}

export function updateCategory(data) {
  return request({
    url: `${api_name}`,
    method: 'put',
    data
  })
}

export function deleteCategory(id) {
  return request({
    url: `${api_name}/${id}`,
    method: 'delete'
  })
}

export function getCategoryNestedList() {
  return request({
    url: `${api_name}/nested`,
    method: 'get'
  })
}


export function getAllCategoryNestedList() {
  return request({
    url: `${api_name}/nested`,
    method: 'get'
  })
}
